From: Stefan Monnier Date: Wed, 21 Mar 2012 17:44:55 +0000 (-0400) Subject: * lisp/files.el (move-file-to-trash): Files aren't regexps. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~324^2~399 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=94f57e840b378f7783bab39ada6042331d5bf12e;p=emacs.git * lisp/files.el (move-file-to-trash): Files aren't regexps. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 22a865d78ed..50d33370957 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2012-03-21 Stefan Monnier + + * files.el (move-file-to-trash): Files aren't regexps (bug#11055). + 2012-03-21 Sam Steingold * progmodes/etags.el (tags-completion-at-point-function): diff --git a/lisp/files.el b/lisp/files.el index cde15c5d0b1..8c61c288be9 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6563,7 +6563,7 @@ Otherwise, trash FILENAME using the freedesktop.org conventions, (new-fn (expand-file-name (file-name-nondirectory fn) trash-dir))) ;; We can't trash a parent directory of trash-directory. - (if (string-match fn trash-dir) + (if (string-prefix-p fn trash-dir) (error "Trash directory `%s' is a subdirectory of `%s'" trash-dir filename)) (unless (file-directory-p trash-dir) @@ -6595,10 +6595,10 @@ Otherwise, trash FILENAME using the freedesktop.org conventions, (file-name-directory fn))) (error "Cannot move %s to trash: Permission denied" filename)) ;; The trashed file cannot be the trash dir or its parent. - (if (string-match fn trash-files-dir) + (if (string-prefix-p fn trash-files-dir) (error "The trash directory %s is a subdirectory of %s" trash-files-dir filename)) - (if (string-match fn trash-info-dir) + (if (string-prefix-p fn trash-info-dir) (error "The trash directory %s is a subdirectory of %s" trash-info-dir filename))